package hotgammon.view.tools;

import hotgammon.domain.*;
import hotgammon.view.*;
import hotgammon.view.figures.*;

import java.awt.event.MouseEvent;

import minidraw.framework.*;
import minidraw.standard.*;

/** Tool to specifically move checkers. Note that this tool is tightly
 * coupled to the BoardLayout as it uses its definitions to match
 * graphical location with game locations.
 *
 * Author Henrik Bærbak Christensen
 */

public class WinnerTool extends NullTool  {
    
    private BackgammonUserInterface objectServer;
    
    public WinnerTool(BackgammonUserInterface ui) {
        this.objectServer = ui;
    }
    
    public void mouseDown(MouseEvent e, int x, int y) {
        printWinner();
    }
    
    public void mouseDrag(MouseEvent e, int x, int y) {
        printWinner();
    }
    
    public void mouseUp(MouseEvent e, int x, int y) {
        printWinner();
    }
    
    public void printWinner() {
        objectServer.getEditor().showStatus(objectServer.getGame().winner()+" wins this game. Press N to start a new game..");
    }
}
